
$(".block").click( function () { 
	who = $("#who").html();
	down(who,this.id);
	if(who==2)
	{
	$(this).addClass("down p1");
	$("#who").html(1);
	}
	else
	{
	$(this).addClass("down p2");
	$("#who").html(2);
	};
});

function aa(id,whos) 
{ 
$.get('ajax.php',{action:'down',who:id}, 
function(data) 
{ 
if(data == 1) 
{
//do something 
alert("1"); 
} 
else 
{ 
setTimeOut("aa()",5000); 
}
},'text'); 
}
function down(id,whos)
{
$.get('ajax.php',{action:'down',id:id,whos:whos},function(data){
    alert("Data Loaded: " + data);
  });
}